<template>
  <div class="homePageBox">
    <el-row :gutter="20">
      <el-col :span="16">
        <div
          class="userInfoCardWeather"
          style="
            background: url('https://saas2-aliyun.oss-cn-hangzhou.aliyuncs.com/saas2/publicFile/tenant_533990185986437120/tenantCustomImg/20231118/1700311531748.jpg');
          "
        >
          <div class="card_top">
            <div class="avatar_box">
              <img
                src="../assets/images/active.png"
                class="avatar_frame"
                alt=""
              />
              <img
                src="https://saas2-aliyun.oss-cn-hangzhou.aliyuncs.com/saas2/publicFile/tenant_533990185986437120/sysUserAvatar/20231118/1700311690408.jpg"
                class="avatar"
                alt=""
              />
            </div>
            <div class="text">
              <div class="name">
                <div class="" :title="userInfo.nickName">{{ userInfo.nickName }}</div>
              </div>
              <div class="orgName">{{ userInfo.dept ? userInfo.dept.deptName : '' }}</div>
              <div class="">
                <div class="">
                  <span>本年个人积分</span>
                  <span>19</span>
                  <span>第1名</span>
                </div>
              </div>
            </div>
          </div>
          <div class="card_bottom">
            <div class="count_item">
              <div class="title">组织总数</div>
              <div class="num">19</div>
            </div>
            <div class="split_line"></div>
            <div class="count_item">
              <div class="title">党员总数</div>
              <div class="num">60</div>
            </div>
            <div class="split_line"></div>
            <div class="count_item">
              <div class="title">本年三会一课完成率</div>
              <div class="num">0%</div>
            </div>
            <div class="split_line"></div>
            <div class="count_item">
              <div class="title">本年学习心得提交率</div>
              <div class="num">0%</div>
            </div>
            <div class="split_line"></div>
            <div class="count_item">
              <div class="title">本月党费交纳</div>
              <div class="num">0%</div>
            </div>
          </div>
        </div>
      </el-col>
      <el-col :span="8">
        <div class="menuListBox">
          <div class="menuListBox_top">
            <div class="public_title">我的常用功能</div>
            <div class="set">
              <img
                src="../assets/images/set.png"
                alt=""
                style="width: 14px; height: 14px; margin-right: 10px"
              />
              &emsp; 设置
            </div>
          </div>
          <div class="menu_con">
            <div class="menu_list">
              <div class="menu_box" v-for="(item, index) in 4" :key="index">
                <div class="menu_icon_box">
                  <img
                    class="menu_icon"
                    src="https://saas-2-min-pro.oss-cn-hangzhou.aliyuncs.com/images/saas-home-images/propaganda-work/icon_xczd.png"
                    alt=""
                  />
                </div>
                <div class="">宣传阵地</div>
              </div>
            </div>
            <div class="menu_list">
              <div class="menu_box" v-for="(item, index) in 4" :key="index">
                <div class="menu_icon_box">
                  <img
                    class="menu_icon"
                    src="https://saas-2-min-pro.oss-cn-hangzhou.aliyuncs.com/images/saas-home-images/propaganda-work/icon_xczd.png"
                    alt=""
                  />
                </div>
                <div class="">宣传阵地</div>
              </div>
            </div>
          </div>
        </div>
      </el-col>
    </el-row>
    <el-row :gutter="20" style="margin-top: 20px">
      <el-col :span="16">
        <div class="party_structure">
          <div class="member-structure-wrap">
            <div class="header">
              <div class="public_title">党员结构</div>
              <div class="more">
                <i class="el-icon-arrow-right"></i>
              </div>
            </div>
            <div class="chart-wrap">
              <div class="chart">
                <div class="manAndWomen">
                  <div class="">
                    <img src="../assets/images/nan.png" alt="" />
                    <div class="slideHeight" style="height: 40px">
                      <img src="../assets/images/nan_pink.png" alt="" />
                    </div>
                    <p>37%</p>
                  </div>
                  <div class="">
                    <img src="../assets/images/nv.png" alt="" />
                    <div class="slideHeight" style="height: 29px">
                      <img src="../assets/images/nv_pink.png" alt="" />
                    </div>
                    <p>23%</p>
                  </div>
                </div>
              </div>
              <div class="chart">
                <pie-chart width="150px" height="150px" />
              </div>
            </div>
          </div>
          <div class="structure-line"></div>
          <div class="three-lesson-wrap">
            <div class="header">
              <div class="public_title">三会一课</div>
              <div class="right_tag_box" style="display: flex">
                <div class="item_tag">
                  <img src="../assets/images/icon3.png" alt="" />
                  <div class="">数据驾驶舱</div>
                </div>
                <div class="item_tag">
                  <img src="../assets/images/icon4.png" alt="" />
                  <div class="">组织概况</div>
                </div>
              </div>
            </div>
            <div class="lesson-bar-chart">
              <bar-chart />
            </div>
          </div>
          <div class="bottom-line"></div>
          <div class="member-structure-wrap">
            <div class="header">
              <div class="public_title">移动端使用时长</div>
            </div>
            <div class="con_box">
              <div class="chart_block">
                <div class="top_box">
                  <div class="chart_title">总时长统计</div>
                  <el-radio-group v-model="radio" size="mini">
                    <el-radio-button label="近6月"></el-radio-button>
                    <el-radio-button label="近1月"></el-radio-button>
                    <el-radio-button label="近7日"></el-radio-button>
                  </el-radio-group>
                </div>
                <div class="echarts-for-react" style="height: 260px"></div>
              </div>
            </div>
          </div>
          <div class="structure-line"></div>
          <div class="three-lesson-wrap">
            <div class="header" style="padding-top: 40px">
              <div class="chart_title">组织积分排名</div>
              <div class="more">
                <i class="el-icon-arrow-right"></i>
              </div>
            </div>
            <div
              class="tenant-wrap"
              style="max-height: 260px; overflow-y: auto"
            >
              <div class="list" v-for="(item, index) in 4" :key="index">
                <img v-if="index == 0" src="../assets/images/one.png" alt="" />
                <img
                  v-else-if="index == 1"
                  src="../assets/images/two.png"
                  alt=""
                />
                <img
                  v-else-if="index == 2"
                  src="../assets/images/three.png"
                  alt=""
                />
                <span v-else>{{ index + 1 }}</span>
                <div class="">
                  <div class="">
                    <h1>中共兴平市组织部党委</h1>
                    <h2>党员人数：5人</h2>
                  </div>
                  <p>总分<span>0分</span></p>
                </div>
              </div>
            </div>
          </div>
        </div>
      </el-col>
      <el-col :span="8">
        <div class="leader-ship-box">
          <div class="header">
            <div class="public_title">领导视图</div>
            <div class="more">
              <i class="el-icon-arrow-right"></i>
            </div>
          </div>
          <div class="ship-item-wrap">
            <div
              class="view-item"
              :class="{
                color_0: index == 0,
                color_1: index == 1,
                color_2: index == 2,
                color_3: index == 3,
              }"
              v-for="(item, index) in 4"
              :key="index"
            >
              <div class="view-logo">
                <img src="../assets/images/icon1.png" alt="" />
              </div>
              <div class="view-org-name">中共兴平市组织部党委</div>
            </div>
          </div>
        </div>
        <div class="leader-ship-box">
          <div class="header">
            <div class="public_title">宣传阵地</div>
            <div class="more">
              <i class="el-icon-arrow-right"></i>
            </div>
          </div>
          <div class="ship-item-wrap">
            <div class="view-item">
              <img
                src="../assets/images/icon2.png"
                style="width: 15px; height: auto; margin-right: 14px"
                alt=""
              />
              <div class="flag-org-name">中国共产党兴平市委员会</div>
            </div>
          </div>
        </div>
        <div class="leader-ship-box">
          <div class="header">
            <div class="public_title">通知公告</div>
            <div class="more">
              <i class="el-icon-arrow-right"></i>
            </div>
          </div>
          <div class="ship-item-wrap">
            <div class="notice_detail">
              <div class="title">213123</div>
              <div class="time">13123</div>
            </div>
          </div>
        </div>
      </el-col>
    </el-row>
  </div>
</template>
<script>
import PieChart from "./dashboard/PieChart";
import BarChart from "./dashboard/BarChart.vue";
import { getuserinfo } from "@/api/system/users";
export default {
  name: "Index_v2",
  components: { PieChart, BarChart },
  data() {
    return {
      radio: "近6月",
      userInfo:{},//用户信息
    };
  },
  methods: {
    getUserInfo() {
      getuserinfo().then((res) => {
        this.userInfo = res.data;
      });
    },
  },
  created() {
    this.getUserInfo();
  },
};
</script>

<style lang="scss" scoped>
.homePageBox {
  color: #333;
  margin: 24px 16px 0;
  .userInfoCardWeather {
    position: relative;
    background-repeat: no-repeat;
    background-size: cover;
    height: 250px;
    padding: 20px 20px 0;
    border-radius: 16px;
    overflow: hidden;
    .card_top {
      display: flex;
      height: 50%;
      border-bottom: 1px solid #eed5a6;
      .avatar_box {
        position: relative;
        width: 100px;
        height: 100px;
        .avatar_frame {
          position: absolute;
          left: 0;
          top: 0;
          width: 100px;
          height: 100px;
        }
        .avatar {
          width: 100px;
          height: 100px;
          border-radius: 100%;
        }
      }
      .text {
        padding-left: 20px;
        color: #8a5c02;
        font-size: 14px;
        line-height: 30px;
        .name {
          font-size: 22px;
        }
      }
    }
    .card_bottom {
      display: flex;
      height: 50%;
      justify-content: space-between;
      align-items: center;
      .count_item {
        width: 24%;
        text-align: center;
        .title {
          color: #8a5c02;
          font-size: 14px;
        }
        .num {
          color: rgb(22, 23, 74);
          font-size: 24px;
        }
      }
      .split_line {
        width: 1px;
        height: 55px;
        background-color: rgb(238, 213, 166);
      }
    }
  }
  .more {
    width: 20px;
    height: 20px;
    line-height: 20px;
    background-color: #eeeff3;
    font-size: 14px;
    cursor: pointer;
    text-align: center;
    color: #16174a;
  }
}
.menuListBox {
  height: 250px;
  border-radius: 16px;
  .menuListBox_top {
    position: relative;
    display: flex;
    justify-content: space-between;
    padding: 0px 20px;
    .public_title {
      font-size: 18px;
      font-weight: 700;
    }
    .set {
      padding: 4px 12px;
      font-size: 14px;
      background-color: rgb(238, 239, 243);
      color: rgb(22, 23, 74);
      cursor: pointer;
      display: flex;
      align-items: center;
    }
  }
  .menu_con {
    display: flex;
    flex-direction: column;
    justify-content: space-around;
    height: 230px;
    .menu_list {
      margin-bottom: 10px;
      display: flex;
      .menu_box {
        width: 25%;
        font-size: 14px;
        text-align: center;
        .menu_icon_box {
          margin: 0px auto;
          width: 60px;
          height: 60px;
          .menu_icon {
            width: 100%;
            cursor: pointer;
          }
        }
      }
    }
  }
}
.party_structure {
  background: #fff;
  border-radius: 16px;
  padding: 20px;
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  .header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 16px;
    align-items: center;
    .public_title {
      font-size: 18px;
      font-weight: 700;
    }
    .item_tag {
      margin-left: 10px;
      padding: 4px;
      font-size: 14px;
      background-color: #eeeff3;
      color: #16174a;
      cursor: pointer;
      display: flex;
      align-items: center;
      img {
        width: 14px;
        height: 14px;
        margin-right: 10px;
      }
    }
  }
  .member-structure-wrap {
    width: calc(60% - 41px);

    .chart-wrap {
      display: flex;
      align-items: center;
      justify-content: space-around;
      .chart {
        width: 200px;
        height: 200px;
        display: flex;
        align-items: center;
        justify-content: center;
        .manAndWomen {
          margin-top: 20px;
          display: flex;
          justify-content: center;
          div {
            margin-right: 12px;
            position: relative;
            width: 66px;
            height: 120px;
            img {
              width: 66px;
              height: 120px;
              position: absolute;
              left: 0;
              bottom: 0;
              object-fit: unset;
            }
            div {
              width: 66px;
              overflow: hidden;
              position: absolute;
              left: 0;
              bottom: 0;
              z-index: 20;
            }
            p {
              width: 66px;
              position: absolute;
              left: 0;
              bottom: 0;
              z-index: 30;
              text-align: center;
              line-height: 120px;
              font-size: 20px;
              color: #ffffff;
            }
          }
        }
      }
    }
  }
  .structure-line {
    border-right: 1px dashed #dcdcdc;
  }
  .bottom-line {
    border-top: 1px solid #e6e7eb;
    width: 100%;
    margin: 30px 0;
  }
  .three-lesson-wrap {
    width: 40%;
  }
  .con_box {
    .top_box {
      display: flex;
      align-items: center;
      justify-content: space-between;
    }
  }
  .chart_title {
    font-size: 16px;
    padding: 5px 0;
  }
}
.leader-ship-box {
  padding: 20px;
  background: #fff;
  border-radius: 16px;
  margin-bottom: 15px;
  .header {
    display: flex;
    margin-bottom: 13px;
    justify-content: space-between;
    .public_title {
      font-size: 18px;
      font-weight: 700;
    }
  }
  .ship-item-wrap {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    .view-item {
      width: calc(50% - 8px);
      height: 55px;
      border-radius: 6px;
      display: flex;
      align-items: center;
      padding: 8px 6px;
      box-sizing: border-box;
      margin-bottom: 10px;
      cursor: pointer;
      .flag-org-name {
        font-size: 15px;
        color: #000;
      }
      .view-logo {
        width: 40.32px;
        height: 40.32px;
        display: flex;
        align-items: center;
        justify-content: center;
        background: #ffffff;
        border-radius: 100%;
        margin-right: 5px;
        img {
          width: 60%;
          height: auto;
          margin-right: 0;
        }
      }
      .view-org-name {
        width: calc(100% - 45.32px);
        font-family: PingFangSC-Medium;
        font-size: 14px;
        color: #fff;
        overflow: hidden;
        text-overflow: ellipsis;
        display: -webkit-box;
        -webkit-line-clamp: 2;
        -webkit-box-orient: vertical /*! autoprefixer: on */;
      }
    }
    .notice_detail {
      margin-top: 14px;
      height: 70px;
      cursor: pointer;
      .title {
        font-size: 16px;
        font-weight: 400;
        display: -webkit-box;
        -webkit-box-orient: vertical;
        -webkit-line-clamp: 2; /* 显示的行数，可以根据需要修改 */
        overflow: hidden;
        text-overflow: ellipsis;
      }
      .time {
        color: rgba(0, 0, 0, 0.45);
        font-size: 14px;
      }
    }
    .color_0 {
      background-image: none !important;
      background: #fe4c4e;
    }
    .color_1 {
      background-image: none !important;
      background: #4481ff;
    }
    .color_2 {
      background-image: none !important;
      background: #ffa751;
    }
    .color_3 {
      background-image: none !important;
      background: #00cdf1;
    }
  }
}
.tenant-wrap {
  // display: flex;
  // align-items: center;
  // justify-content: space-between;
  .list {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    & > span {
      width: 16px;
      height: 16px;
      background: #ffd9e0;
      color: #fff;
      font-size: 12px;
      text-align: center;
      line-height: 16px;
      border-radius: 50%;
    }
    & > div {
      width: calc(100% - 40px);
      border-bottom: 1px solid #e6e7eb;
      align-items: center;
      padding-top: 10px;
      display: flex;
      & > div {
        flex: 1;
        h1 {
          font-size: 15px;
          color: #333;
          margin-bottom: 5px;
          word-break: break-all;
        }
        h2 {
          margin-bottom: 10px;
          font-size: 12px;
          color: #8c8c8c;
          font-weight: 400;
        }
      }
      p {
        color: #8c8c8c;
        font-size: 12px;
        span {
          color: #ff4d4f;
          font-size: 15px;
          padding-left: 6px;
        }
      }
    }
  }
  img {
    width: 20px;
    height: auto;
  }
}
</style>
